<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

//用户模型
class News extends Model
{
    protected $table = 'news';

    public $timestamps = false;

    protected $primaryKey = 'id';
    //白名单
    protected $fillable = [
        'id',
        'title',
        'type_id',
        'img',
        'from',
        'contents',
        'create_time',
        'isread',
        'is_delete',
        'img_oss',
    ];

    //与文章点评表关联
    public function news_dianping()
    {
        return $this->hasMany('App\\Models\\NewsDianping', 'news_id', 'id');
    }

    //与文章点赞表关联
    public function news_dianzan()
    {
        return $this->hasMany('App\\Models\\NewsDianzan', 'news_id', 'id');
    }
}
